package com.gitee.magic.framework.base.spring;

import org.springframework.context.ApplicationContext;

import com.gitee.magic.core.exception.ApplicationException;

/**
 * @author start
 */
public class SpringContext {

	private static ApplicationContext appContext;
	
	public static Boolean isInitContext() {
		return appContext != null;
	}

	public static ApplicationContext getAppContext() {
		if (!isInitContext()) {
            throw new ApplicationException("请先初始化，ApplicationContext容器对象");
        }
		return appContext;
	}

	public static void setAppContext(ApplicationContext appContext) {
		SpringContext.appContext = appContext;
	}
	
}
